package cn.tedu.entity;

import cn.tedu.constant.WxConstant;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;

import java.util.Map;

/**
 * @author Kiven
 */
@Data
public class BaseMsg {

    @XStreamAlias("ToUserName")
    private String toUserName;

    @XStreamAlias("FromUserName")
    private String fromUserName;

    @XStreamAlias("CreateTime")
    private String createTime;

    @XStreamAlias("MsgType")
    private String msgType;

    void init(Map<String, Object> map) {
        this.createTime = String.valueOf(map.get(WxConstant.CREATE_TIME));
        this.fromUserName =
                String.valueOf(map.get(WxConstant.FROM_USER_NAME));
        this.toUserName = String.valueOf(map.get(WxConstant.TO_USER_NAME));
        this.msgType = String.valueOf(map.get(WxConstant.MSG_TYPE));
    }
}
